#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll m,b;
int main(void){
    scanf("%lld%lld",&m,&b);
    ll ans=0;
    for(ll y=0;y<=b;y++){
        ll x=m*(b-y);
        ans=max(ans,(x+y)*(y+1)*(x+1)/2);
    }
    printf("%lld\n",ans);
    return 0;
}